package edu.cmu.cs211.snake.date;

import java.util.Set;

public class DateMain 
{
	private static final int NUM_TEST_CASES = 10000;	// number of elements to add to the hashtable
	private static final int NUM_TEST_RUNS = 10;		// number of times to run the test
	
	/**
	 * Test the number of collisions using your Date.hashCode() based on the
	 * number of times that equals() is called.
	 */
	public static void main(String[] args)
	{
		int collisionCount = 0;		
		
		for(int i = 0; i < NUM_TEST_RUNS; i++)
		{
			Set <Date> dates = new java.util.HashSet <Date> ();
			
			for (int j = 0; j < NUM_TEST_CASES; j++) 
			{
				dates.add (new Date());
			}
	
			for (Date date : dates)
			{
				collisionCount += date.getNumEqualCalls();
			}
		}
		
		System.out.println("Number of collisions for " + NUM_TEST_CASES + " items, averaged over " 
				+ NUM_TEST_RUNS + " test runs is " + ((double)collisionCount) / NUM_TEST_RUNS);
	}
}
